package com.xzy.sms.web.system.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.xzy.sms.web.domain.entity.User;

/**
 * 权限人员关联表(因为建表的时候已经是pub_开头了,如果修改为perm_开头还需要修改表的数据，所有这里暂时不做调整)
 * 
 * @author macong
 * @since 1.0
 * @version 2014-4-1 macong
 */
@Entity
@Table(name = "pub_perm_user")
public class PermUser {
    
    /** id */
    @Id
    @GeneratedValue(generator = "UIDGenerator")
    @GenericGenerator(name = "UIDGenerator", strategy = "com.xzyframework.persistence.UIDGenerator")
    @Column(length = 40)
    private String id;
    
    /** 权限串 */
    private String permStr;
    
    /** 用户id */
    @ManyToOne
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "user_id", referencedColumnName = "userId")
    private User user;
    
    /**
     * 构造函数
     */
    public PermUser() {
    }
    
    /**
     * 构造函数
     * 
     * @param permStr permStr
     * @param user user
     * @param tenant tenant
     */
    public PermUser(String permStr, User user) {
        this.permStr = permStr;
        this.user = user;
    }
    
    /**
     * @return id
     */
    public String getId() {
        return id;
    }
    
    /**
     * @param id 要设置的 id
     */
    public void setId(String id) {
        this.id = id;
    }
    
    /**
     * @return permStr
     */
    public String getPermStr() {
        return permStr;
    }
    
    /**
     * @param permStr 要设置的 permStr
     */
    public void setPermStr(String permStr) {
        this.permStr = permStr;
    }
    
    /**
     * @return user
     */
    public User getUser() {
        return user;
    }
    
    /**
     * @param user 要设置的 user
     */
    public void setUser(User user) {
        this.user = user;
    }
    
}
